﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using PixentrationEngine;
using Pixentration;

namespace Pixentration
{
    /// <summary>
    /// Interaction logic for EndGame.xaml
    /// </summary>
    public partial class EndGame : Window
    {
        public String playerInitials;

        /// <summary>
        /// End of game initialization
        /// </summary>
        public EndGame()
        {
            InitializeComponent();
            
            
        }

        /// <summary>
        /// Ok Button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks> <para> The okbutton causes the dialog box to close as well as set the
        /// user's initials to the dialog scoped global variable</para>
        /// </remarks>
        private void OKbutton_Click(object sender, RoutedEventArgs e)
        {
            playerInitials = Initials.Text;
            this.Close();
        }

        /// <summary>
        /// set the fields for the score at end of game
        /// </summary>
        /// <param name="score">base score</param>
        /// <param name="bonus">time bonus</param>
        /// <param name="total"> total score</param>
        /// <remarks> <para> This is simply a setter value for the three score fields 
        /// on the dialog</para> </remarks>
        public void setFields(int score, int bonus, int total)
        {
            baseScoreBox.Text = score.ToString();
            bonusScoreBox.Text = bonus.ToString();
            totalScoreBox.Text = total.ToString();
        }

        /// <summary>
        /// sets visible fields based on boolean value
        /// </summary>
        /// <param name="a">is the value a high score</param>
        /// <remarks> <para>Depending on whether or not there is a high score a different set of 
        /// fields will be made visible.  If there is no high score the box for the initials
        /// will not be visible and the label for Game over will be visible.</para>
        /// </remarks>
        public void isHighScore(Boolean a)
        {
            if (a)
            {
                InitialLabel.Opacity = 1;
                Initials.Opacity = 1;
                OKbutton.IsEnabled = true;
                OKbutton.Opacity = 1;
                newHighScore.Text = "NEW HIGH SCORE!";
            }
            else
            {
                InitialLabel.Opacity = 0;
                Initials.Opacity = 0;
                OKbutton.IsEnabled = true;
                OKbutton.Opacity = 1;
                newHighScore.Text = "GAME OVER";
            }
        }

        /// <summary>
        /// Getter for the value playerInitials
        /// </summary>
        /// <returns> A String containing the players initials</returns>
        public String getInitials()
        {
            return playerInitials;
        }
    }
}
